<template>
  <div class="select">
    <a-select
      v-bind="bind"
      :value="value"
      @update:value="change"
      style="width: 120px"
      ref="select"
    >
      <a-select-option
        v-for="(item, index) in struct"
        :key="index"
        v-bind="item"
        >{{ item.label }}</a-select-option
      >
    </a-select>
  </div>
</template>
<script lang="ts">
import { useChangeObj } from '../../utils/useChangeObj';
import { computed, defineComponent, PropType, ref } from "vue";
interface struct {
  label: string;
  value: string;
}
export default defineComponent({
  props: {
    struct: {
      type: Array as PropType<Array<struct>>,
      default: () => [],
    },
    value: Object,
  },
  name: "DSelect",
  setup(props, { emit, attrs }) {
    const bind = computed(()=>{
      return attrs;
    })
    const change = (value: any) => {
      emit("update:value", value);
    };
    return {
      bind,
      change,
    };
  },
});
</script>
<style scoped>
</style>
